一个比 nrm 更好用的镜像源管理工具 |
您所在的位置:网站首页 › npm 镜像地址 › 一个比 nrm 更好用的镜像源管理工具 |
小知识,大挑战!本文正在参与“程序员必备小知识”创作活动。 此前介绍过一个 NPM 镜像源管理工具,可以快速切换 NPM 源,那就是 nrm。 详见文章:nrm 使用详解。 最原始设置 NPM 或 YARN 源的命令对应如下: # use npm $ npm config set registry # use yarn $ yarn config set registry而使用 nrm 可以快速地切换源: # nrm use taobao $ nrm use但是这个有点不爽,就是说它只会切换 npm 命令的镜像源,nrm 无法修改 yarn 的。 最近发现了一个 yrm(YARN registry manager)工具,可以同步修改 npm 和 yarn 镜像源,它本身也是 nrm 的一个 Fork 分支。 # install $ npm i yrm -g # switch registry $ yrm use # ...使用方法与 nrm 一致,就不多说了。如果对 nrm 不了解的话,可以先看看前面那篇文章。也可以通过 -h 查看所有命令。 frankie@iMac ~ % 🐶 yrm -h Usage: yrm [options] [command] Options: -V, --version output the version number -h, --help output usage information Commands: ls List all the registries current Show current registry name use Change registry to registry add [home] Add one custom registry del Delete one custom registry home [browser] Open the homepage of registry with optional browser test [registry] Show response time for specific or all registries help Print this help当你使用其他非预设注册表时,不能使用 publish 命令。通常我发布 NPM 包都是直接使用 npm public 命令。 效果如下: frankie@iMac ~ % 🐶 yrm use taobao YARN Registry has been set to: https://registry.npm.taobao.org/ NPM Registry has been set to: https://registry.npm.taobao.org/「重要通知」原淘宝 npm 域名即将停止解析,请切换至新域名 npmmirror.com,http://npm.taobao.org和 http://registry.npm.taobao.org 将在 2022.06.30 号正式下线和停止 DNS 解析。 由于 yrm 包最新一次更新还是五年前,因此淘宝镜像的域名还是旧域名,可以通过以下方式进行更新: $ yrm add taobao https://registry.npmmirror.com/Refenerces nrm - Github yrm - Github nrm 使用详解 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |